﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DAO;
using DVO;

/// <summary>
/// Summary description for BLL_Member
/// </summary>
public class BLL_Member:MemberDataContext
{
	public BLL_Member()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public List<ins_RolesDetail_SelectAllResult> Roels_SelectALL()
    {
        List<ins_RolesDetail_SelectAllResult> ObjList = new List<ins_RolesDetail_SelectAllResult>();
        try
        {
            ObjList = ins_RolesDetail_SelectAll().ToList();
        }
        catch (Exception ex)
        {
            Common.WriteLog(ex.Message, ex.StackTrace);
        }
        return ObjList;
    }

    public List<ins_Member_SelectLevelResult> Level_Select(int level)
    {
        List<ins_Member_SelectLevelResult> ObjList = new List<ins_Member_SelectLevelResult>();
        try
        {
            ObjList = ins_Member_SelectLevel(level).ToList();
        }
        catch (Exception ex)
        {
            Common.WriteLog(ex.Message, ex.StackTrace);
        }
        return ObjList;
    }
    public int Insert_member(string username, string password, int rolesid,string fullname)
    {
        int IdReturn = 0;
        try
        {
            IdReturn = ins_Member_Insert(username, password, rolesid, fullname);
        }
        catch (Exception ex)
        {
            Common.WriteLog(ex.Message, ex.StackTrace);
        }
        return IdReturn;
    }
    public int UpdatePass_Member(string username, string password)
    {
        int IdReturn = 0;
        try
        {
            IdReturn = ins_Member_UpdatePass(username, password);
        }
        catch (Exception ex)
        {
            Common.WriteLog(ex.Message, ex.StackTrace);
        }
        return IdReturn;
    }

    public ins_Member_SelectEmailResult SelectEmail(int Id)
    {
        ins_Member_SelectEmailResult ObjList = new ins_Member_SelectEmailResult();
        try
        {
            ObjList = ins_Member_SelectEmail(Id).SingleOrDefault();
        }
        catch (Exception ex)
        {
            Common.WriteLog(ex.Message, ex.StackTrace);
        }
        return ObjList;
    }
   

}